package fr.inserm.u915.organifooyi.model;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity(name="tube")
@Table(name="tube")
@NamedQueries({
	})
public class Tube
	extends AbstractUpdatableObject
	{
	@Column(name="tubeIndex")
	private Short tubeIndex;
	
	@ManyToOne(fetch=FetchType.LAZY,optional=false)
	@JoinColumn(name="reception_id")
	private ReceptionTubes receptionTubes;
	
	@ManyToOne(fetch=FetchType.LAZY,optional=true,cascade=CascadeType.PERSIST)
	@JoinColumn(name="extraction_id")
	private Extraction extraction;

	
	public Tube() {
		}
	
	public Short getTubeIndex()
		{
		return tubeIndex;
		}
	public void setTubeIndex(Short tubeIndex) {
		this.tubeIndex = tubeIndex;
		}
	
	public ReceptionTubes getReceptionTubes() {
		return receptionTubes;
		}
	public void setReceptionTubes(ReceptionTubes receptionTubes)
		{
		this.receptionTubes = receptionTubes;
		}
	
	@Transient
	public ReceptionTubes getReception()//just an alias
		{
		return getReceptionTubes();
		}
	
	public Extraction getExtraction()
		{
		return extraction;
		}
	
	public void setExtraction(Extraction extraction)
		{
		this.extraction = extraction;
		}
	
	}

